home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 3
/
Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso
/
comms
/
netsoftware
/
atcp_finger.lha
/
finger
/
amiga.c
next >
Wrap
C/C++ Source or Header
|
1993-08-10
|
598b
|
41 lines
/*
* This is only for the GNU C Compiler.
*/
#include <bsdsocket.h>
#include <sys/types.h>
#include <signal.h>
#include <exec/libraries.h>
#include <dos/dosextens.h>
#include <dos/dos.h>
#include <sys/time.h>
int sgetc(int sock)
{
unsigned char c;
fd_set rd,ex;
long flgs;
int n;
struct timeval t;
t.tv_sec = 10L;
t.tv_usec = 0;
FD_ZERO(&rd);
FD_ZERO(&ex);
FD_SET(sock,&rd);
FD_SET(sock,&ex);
flgs = SIGBREAKF_CTRL_D;
WaitSelect(16,&rd,0L,&ex,&t,&flgs);
if (FD_ISSET(sock,&rd))
{ n = recv(sock, &c, 1, 0);
if (n == 1)
return c;
else return -1;
}
else return -1;
}